package main

import (
	"google.golang.org/protobuf/proto"
	"learn-protobuf/basic"
	"learn-protobuf/example"
)

func main() {
	var logger = basic.Logger{}

	// 创建消息
	p := &example.Person{
		Name:    "Alice",
		Age:     25,
		Hobbies: []string{"coding", "hiking"},
	}
	// 序列化
	data, _ := proto.Marshal(p)
	logger.Info("Encoded: %v", data)
	// 反序列化
	newP := &example.Person{}
	proto.Unmarshal(data, newP)
	logger.Info("Decoded: %v", data)
}
